package 补充.集合框架;
import java.util.*;
class Cat {
    private String name;
    private char sex;
    private String color;
    private String status;

    public Cat(String name, char sex, String color, String status) {
        this.name = name;
        this.sex = sex;
        this.color = color;
        this.status = status;
    }

    public String getName() {
        return name;
    }

    public char getSex() {
        return sex;
    }

    public String getColor() {
        return color;
    }

    public String getStatus() {
        return status;
    }
}
public class TestIterator {
    public static void main(String[] args) {
        List<Cat> list = new ArrayList<>();
        Cat cat1 = new Cat("小猫", '母', "橘猫", "收留");
        Cat cat2 = new Cat("小猫", '母', "橘猫", "收留");
        Cat cat3 = new Cat("小猫", '母', "橘猫", "收留");
        Cat cat4 = new Cat("小猫", '母', "橘猫", "收留");
        list.add(cat1);
        System.out.println("cat1:"+cat1);
        list.add(cat2);
        list.add(cat3);
        list.add(cat4);
        Iterator<Cat> iterator = list.iterator();
        while (iterator.hasNext()) {
            Cat cat = iterator.next();
            System.out.println(cat);
        }
    }
}